package qwq.zyu.Utils;

public class UnicodeUtil {

    /**
     * 将中文字符串转换为Unicode转义字符
     * @param input 中文字符串
     * @return Unicode转义字符字符串
     */
    public static String HanziString2UnicodeChar(String input) {
        StringBuilder unicodeStrBuilder = new StringBuilder();
        for (int i = 0; i < input.length(); i++) {
            char c = input.charAt(i);
            unicodeStrBuilder.append("\\u").append(String.format("%04X", (int) c));
        }
        return unicodeStrBuilder.toString();
    }
}